﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
namespace SurfaceApplication1
{
    public class AbstractEventHandler
    {
        private WindowsView _myView;
        private ImageModel _myModel;

        public AbstractEventHandler(WindowsView view)
        {
            _myView = view;
            _myModel= new ImageModel();
        }

        #region Handlers
        public void boutonClick_Event(object sender, RoutedEventArgs e1)
        {
            String[] fichiers = new string[] { };
            _myModel.GetFiles(ref fichiers, _myView.readTextBoxField());
            _myView.updateListboxField(new List<string>(fichiers));

        }
        public void listBox1_SelectionChanged(object sender, RoutedEventArgs e1)
        {
            _myView.updateImageField(_myView.readListBoxSelectedField());
            _myModel.Height = _myView.readImageHeightField();
            _myModel.Width = _myView.readImageWidthField();

        }
        public void slider1_ValueChanged(object sender, RoutedEventArgs e1)
        {
             RoutedPropertyChangedEventArgs<double> e = (RoutedPropertyChangedEventArgs<double>)e1;
            if (_myView!= null)
                _myView.updateImageSize(_myModel.Width * _myView.readSliderValueField(), _myModel.Height* _myView.readSliderValueField());

        }
        public void image1_ImageFailed(object sender, RoutedEventArgs e1)
        {
            ExceptionRoutedEventArgs e = (ExceptionRoutedEventArgs)e1;

        }

        #endregion

    }
}
